package com.lenovo.rc.sil.wangdwa.learning;

import android.app.Activity;
import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.WindowManager;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;


public class SimpleActivity extends Activity {
    private static final String TAG = "SimpleActivity";

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Log.i(TAG, "Activity creating....");
    }

	/* (non-Javadoc)
	 * @see android.app.Activity#onDestroy()
	 */
	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		
		Log.i(TAG, "Activity Destroying....");
	}

	/* (non-Javadoc)
	 * @see android.app.Activity#onStart()
	 */
	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		
		Log.i(TAG, "Activity starting....");
		
		showInfo();
	}



	/* (non-Javadoc)
	 * @see android.app.Activity#onStop()
	 */
	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		
		Log.i(TAG, "Activity stopping....");
	}
    
	
	private void showInfo() {
		// TODO Auto-generated method stub
		
		Log.i(TAG, "Title: "+this.getTitle().toString());
//		Log.i(TAG, "Title: "+this.getTitle());
		Log.i(TAG, "Calling Activity: "+this.getCallingPackage());
		
		Application app = this.getApplication();
		Log.i(TAG, "Package: "+app.getPackageName());
		
		Context appContext = this.getApplicationContext();
		Log.i(TAG, "App Context: "+appContext.toString());
		
		AssetManager am = this.getAssets();
		Log.i(TAG, "Asset Manager Locale[1]: "+am.getLocales()[1]);
		
		Context baseContext = this.getBaseContext();
		Log.i(TAG, "Base Context: "+baseContext.toString());		
		
		ContentResolver resolver = this.getContentResolver();
		Log.i(TAG, "Content Resolver: "+resolver.toString());
		
		LayoutInflater inflater = this.getLayoutInflater();
		Log.i(TAG, "Layout Inflater: "+inflater.toString());
		MenuInflater inflater2 = this.getMenuInflater();
		Log.i(TAG, "Menu Inflater: "+inflater2.toString());
		
		Resources resources = this.getResources();
		Log.i(TAG, "Resources: "+resources.toString());
		
		Drawable wallpaper = this.getWallpaper();
		Log.i(TAG, "Wallpaper: "+wallpaper.toString());
		
		Window window = this.getWindow();
		LayoutParams layoutParams = window.getAttributes();
		Log.i(TAG, "Layout Height: "+layoutParams.height+", "
				+"Layout Width: "+layoutParams.width);
		
		WindowManager wm = this.getWindowManager();
		Display disp = wm.getDefaultDisplay();
		Log.i(TAG, "Window Heigh: "+disp.getHeight()+", "
				+"Window Width: "+disp.getWidth());
		
	}
    
}